{template 'public/header'}

{template 'public/comhead'}

<link rel="stylesheet" type="text/css" href="../addons/yzzc_sun/template/public/ygcsslist.css">
<ul class="nav nav-tabs">
    <span class="ygxian"></span>
    <div class="ygdangq">当前位置:</div>
    <li  {if $type=='all'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>all));}">全部门店</a></li>
    <li   {if $type=='wait'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>wait,'status'=>1));}">营业门店</a></li>
    <li   {if $type=='ok'} class="active" {/if}><a href="{php echo $this->createWebUrl('branchslist',array('type'=>ok,'status'=>2));}">停业门店</a></li>
</ul>
<br>
<div class="row ygrow">
    <div class="col-lg-12">
        <form action="" method="get" class="col-md-4">
            <input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="yzzc_sun" />
            <input type="hidden" name="do" value="branchslist" />
            <div class="input-group">
                <input type="text" name="keywords" class="form-control" placeholder="请输入门店名称">
                <span class="input-group-btn">
                    <input type="submit" class="btn btn-default" name="submit" value="查找"/>
                </span>
            </div>
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </form>

        <div class="col-md-4">
            <input type="hidden" name="token" value="{$_W['token']}"/>
        </div>
    </div><!-- /.col-lg-6 -->
</div>

<div class="main ">

    <div class="panel panel-default">
        <div class="panel-heading">
            门店列表
        </div>

        <div class="panel-body" style="padding: 0px 15px;">
            <div class="row" id="accordion">


                <table class="yg5_tabel col-md-12">
                    <tr class="yg5_tr1">
                        <td  class="store_td1 col-md-1">门店名称</td>
                        <td  class="col-md-1">门店类型</td>
                        <td  class="col-md-1">手续费</td>
                        <td  class="col-md-1">提现手续费</td>
                        <td  class="col-md-1">余额</td>
                        <td  class="col-md-1">门店详细地址 </td>
                        <td  class="col-md-1">是否开启送车上门（上门范围） </td>
<!--                        <td  class="col-md-1"> 服务热线</td>-->
                        <td class="col-md-1"> 门店电话</td>
                        <td class="col-md-1">状态</td>
                        <td class="col-md-1">会员状态</td>
                        <td>操作</td>
                    </tr>

                    {loop $info $key $item}
                    <tbody>
                    <tr class="yg5_tr2" >
                        <td>{$item['name']}</td>
                        <td>
                            {if $item['type']==1}
                            <span class="label store-blue btn">平台自营</span>
                            {elseif $item['type']==2}
                            <span class="label store-green btn">商家入驻</span>
                            {elseif $item['type']==3}
                            <span class="label store-yellow btn">个人商户</span>
                            {/if}
                        </td>
                        <td>{$item['platform_fee']}%</td>
                        <td>{$item['payout_fee']}%</td>
                        <td>{$item['balance']}</td>
                        <td>{$item['address']}</td>
                        <td>{if $item['ranges']==0}不上门
                            {else} 支持送车上门（{$item['ranges']}km内）
                            {/if}
                        </td>
<!--                        <td>{$item['business_hours']}</td>-->
<!--                        <td>{$item['service_tel']}</td>-->
                        <td>{$item['shop_tel']}</td>
                        <td>
                            {if $item['status']==1}
                            <span class="label store-green btn">营业中</span>
                            {else}
                            <span class="label store-red btn">已停业</span>
                            {/if}
                        </td>
                        <td>
                            {if $item['member_status']==1}
                            <span>{$item['member_start_time']}~{$item['member_end_time']}</span>
                            {elseif $item['member_status']==0}
                            <span class="label store-red btn">非会员</span>
                            {elseif $item['member_status']==2}
                            <span class="label store-yellow btn">已过期</span>
                            {/if}
                        </td>
                        <td>
                            <a href="/web/index.php?c=site&a=entry&do=branchadminlist&id={$item['id']}&module_name=yzzc_sun&version_id=1"><button class="btn-bottoms btn btn-default btn-xs">管理员列表</button></a>
                            {if $item['status']==1}
                            <a href="/web/index.php?c=site&a=entry&op=change&do=branchslist&id={$item['id']}&states=2&module_name=yzzc_sun&version_id=1">
                                <span class="btn btn-md store-red btn-xs">关闭</span>
                            </a>
                            {else}
                            <a href="/web/index.php?c=site&a=entry&op=change&do=branchslist&id={$item['id']}&states=1&module_name=yzzc_sun&version_id=1">
                                <span class="btn btn-md store-blue btn-xs">启用</span>
                            </a>
                            {/if}
                            <a href="/web/index.php?c=site&a=entry&op=income&do=branch_store_income&id={$item['id']}&module_name=yzzc_sun&version_id=1">
                                <span class="btn btn-md store-blue btn-xs">结算</span>
                            </a>
                            <a href="/web/index.php?c=site&a=entry&do=branch&id={$item['id']}&module_name=yzzc_sun&version_id=1" class="storespan btn btn-xs">
                                <span class="fa fa-pencil"></span>
                                <span class="bianji">编辑
                                    <span class="arrowdown"></span>
                                 </span>
                            </a>
                            <a href="javascript:;" class="storespan btn btn-xs" onclick="del({$item['id']})">
                                <span class="fa fa-trash-o"></span><span class="bianji">删除<span class="arrowdown"></span></span>
                            </a>

                            <!--<a href="{php echo $this->createWebUrl('branchslist', array('id' => $item['id'],'op'=>delete) )}" class="storespan btn btn-xs" >-->
                                <!--<span class="fa fa-trash-o"></span>-->
                                <!--<span class="bianji">删除-->
                                    <!--<span class="arrowdown"></span>-->
                                <!--</span>-->
                            <!--</a>-->
                        </td>
                        <!--<td>-->
                        <!--<a class="fxiala" data-toggle="collapse" data-parent="#accordion" href="#collapse{$row['id']}">-->
                        <!--<span class="fa fa-chevron-down"></span>-->
                        <!--</a>-->
                        <!--</td>-->
                    </tr>
                    </tbody>
                    {/loop}
                    {if empty($item)}
                    <tr class="yg5_tr2">
                        <td colspan="8">
                            暂无地址信息
                        </td>
                    </tr>
                    {/if}
                </table>
            </div>
        </div>

    </div>
    </form>
</div>
<script type="text/javascript">
    $(function(){
        $("#frame-1").show();
        $("#yframe-1").addClass("wyactive");
    })
    function del(id) {
        var ret = confirm("删除前请确认该门店所有车辆均已下架，您确定删除吗？")
        if (ret==true){
            $.ajax({
                type:"POST",
                url:"/web/index.php?c=site&a=entry&op=delete&do=branchslist&op=delete&module_name=yzzc_sun&version_id=1",
                dataType:"JSON",
                data:{id:id},
                success:function(res){
                    if(res.type == 'success') {
                        location.reload();
                    }else{
                        alert('删除失败');
                    }
                }
            })
        }
    }
</script>